<template>
    <div class="app-container" ref="content">
        <div style="text-align: center;padding: 10px">《{{buildingInfo.name}}》-详情信息</div>
      <el-row :gutter="10">
        <el-col :span="12" :offset="6">
            <el-form :model="buildingInfo" ref="buildingInfo" label-width="150px">
                 <el-form-item label="所属主体:" prop="enterpriseName">
                     {{ buildingInfo.enterpriseName }}
                 </el-form-item>
                 <el-form-item label="建筑名称:" prop="name">
                     {{ buildingInfo.name }}
                 </el-form-item>
                 <el-form-item label="详细地址:" prop="loaction">
                     {{ buildingInfo.loaction }}
                 </el-form-item>
                 <el-form-item label="地上层数:" prop="overFloorNum">
                     {{ buildingInfo.overFloorNum }}层
                 </el-form-item>
                 <el-form-item label="地下层数:" prop="underFloorNum">
                     {{ buildingInfo.underFloorNum }}层
                 </el-form-item>
                 <el-form-item label="占地面积:" prop="occupyArea">
                     {{ buildingInfo.occupyArea }}平方米
                 </el-form-item>
                 <el-form-item label="设备总数:" prop="equipmentNum">
                   {{ buildingInfo.equipmentNum }}个
                 </el-form-item>
                 <el-form-item label="容纳消防车数:" prop="fireEngineNum" >
                   {{ buildingInfo.fireEngineNum }}辆
                 </el-form-item>

                 <el-form-item label="建筑类型:" prop="buildingType">
                     {{
                         buildingInfo.buildingType === "11001" ? "民用建筑"
                                 : buildingInfo.buildingType === "11002"  ? "工业建筑"
                                 : buildingInfo.buildingType === "11003"  ? "仓库"
                                         : buildingInfo.buildingType === "11004"? "储罐"
                                                 : buildingInfo.buildingType === "11005" ? "堆场"
                                                         : buildingInfo.buildingType === "11006" ? "装置"
                                                             : "未知"
                     }}
                 </el-form-item>
                 <el-form-item label="周边建筑:" prop="peripheryName" >
                     {{ buildingInfo.peripheryName}}
                </el-form-item>
            </el-form>
        </el-col>
        </el-row>
    </div>
</template>

<script>
import {getInBuildingVo} from "@/api/building";

export default {
    name: "buildingInfo",
    data(){
        return{
            buildingInfo:{

            }
        }
    },
    created() {
        console.log(this.$route.query.ucId)
        this.$nextTick(() => {
            this.getInBuildingVo(this.$route.query.ucId)
        });
    },
    methods:{
        getInBuildingVo(val){
            //获取建筑信息数据
            let loadingInstance = this.$loading({
                target:this.$refs.content,
                text:'数据加载中'
            });
            getInBuildingVo({ucId:val}).then(res=>{
                console.log(res)

                this.buildingInfo = res.data
                loadingInstance.close()
                this.$notify.success({
                    title: '成功',
                    message: "获取建筑信息成功"
                })
            }).catch(error=>{
                console.log(error)
                loadingInstance.close()
                this.$notify.error({
                    title: '失败',
                    message: "获取建筑信息失败"
                })
            })
        },

    }

}
</script>
